<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

    <button id="btn1">跳转百度</button>
    <button id="btn2">刷新</button>
    <button id="btn3">返回</button>

    <script>
        // BOM（Browser Object Model）常用的操作：
        // 返回上一页: history.back()/go(-1)

        // 获取用户设备信息：navigator.appVersion
        console.log(navigator.appVersion);
        // 获取地址栏信息
        // console.log(location);

        //  跳转
        //   location.href = '新地址'
        //  刷新(普通)
        //  location.reload(); 或  history.go(0)

        //  强制刷新（ctrl + f5）

        let btn1ELe = document.getElementById('btn1');
        let btn2ELe = document.getElementById('btn2');
        let btn3ELe = document.getElementById('btn3');

        btn1ELe.addEventListener('click', function () {
            location.href = 'https://www.baidu.com';
        });

        btn2ELe.addEventListener('click', function () {
            location.reload();
            console.log(location);
        });

        btn3ELe.addEventListener('click', function () {
            history.back();
            console.log(history);
        });

    </script>
</body>

</html>